package com.xl.rentkeeper.db.orm;

import com.xl.rentkeeper.db.orm.util.NamingHelper;
import com.xl.rentkeeper.entity.Order;
import com.xl.rentkeeper.msg.Message;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by zhangjimin on 15/4/28.
 */
public class ORMap {
    public static final String TableKeyId = "dbid";
    static Map<String,Class> orMaps = new HashMap<>();
    static List<Class> mappedClasses = new ArrayList<>();
    public static String ORDER_PROCESSING = "orderprocessing";
    public static String ORDER_HISTORY = "orderhistory";

    public static void init() {
        mappedClasses.add(Message.class);
        for (Class c : mappedClasses) {
            orMaps.put(NamingHelper.toSQLName(c),c);
        }
        orMaps.put(ORDER_PROCESSING, Order.class);
        orMaps.put(ORDER_HISTORY, Order.class);
    }

    public static List<Class> getDomainClass() {
        return mappedClasses;
    }

    public static Map<String,Class> getTables() {
        return orMaps;
    }
}
